<?

	js_include('Fmgr.js?dirview');
	css_include('fmgr.css');

	$Tlb = Toolbar();

	$Tlb->option('View')->option('Table')->toFunction('MC.switchView(1)', 'MC && MC.view != 1');
	$Tlb->option('View')->option('Icons')->toFunction('MC.switchView(0)', 'MC && MC.view != 0');

	$Tlb->option('Directory')->option('Show Info')->toFunction('moreInfo(1);');
	$Tlb->option('Directory')->option('Refresh')->toFunction('Dir.refresh();');
	$Tlb->option('Directory')->option('Select All')->toFunction('MC.selectall()');
	$Tlb->option('Directory')->option('Nice Name')->toFunction('Namer.begin();', '!is_null(window.O_ID)');
	$Tlb->option('Directory')->option('Link Here')->toFunction('Smajax.exec("newlink")', 'Dir["class"] !== "Desk"');
	$Tlb->option('Directory')->option('Empty Trash')->toFunction('TUXconfirm("Are you sure?", function(a){ if(a) ajaxExec("empty_trash"); })', '', 'Dir["class"] == "Trash"');

	$Tlb->option('New')->option('Directory')->toFunction('Dir.newDir();', 'Dir["class"] !== "Trash"');
	$Tlb->option('New')->option('Text File')->toFunction('Dir.newFil();', 'Dir["class"] !== "Trash"');
	$Tlb->option('New')->option('Upload')->toFunction('Dir.upload();', 'Dir.writeable && Dir["class"] !== "Trash"');
	$Tlb->option('New')->option('Softlink (SMUOI)')->toFunction('Dir.newlink();', 'Dir.writeable && Dir["class"] !== "Trash"');
	if(is_root() && usr()->can_symlink) $Tlb->option('New')->option('Symlink (Host)')->toFunction('Dir.newsym();', 'Dir.writeable && Dir["class"] !== "Trash"');
	
	$Tlb->option('Selection')->option('Cut')->toFunction('Clipboard.cut();', 'Dir.writeable && Selection.length');
	$Tlb->option('Selection')->option('Copy')->toFunction('Clipboard.copy();', 'Selection.length');
	
	$Tlb->option('Selection')->option('Paste')->toFunction('Clipboard.paste()', 'Dir.writeable && Clipboard.length && Dir["class"] !== "Trash"');
	$Tlb->option('Selection')->option('Rename')->toFunction('Dir.rename()', 'Dir.writeable && (Selection.length == 1) && Dir["class"] !== "Trash"');
	$Tlb->option('Selection')->option('Duplicate')->toFunction('Dir.duplicate()', 'Dir.writeable && Selection.length && Dir["class"] !== "Trash"');
	$Tlb->option('Selection')->option('GZIP')->option('Pack')->toFunction('Dir.pack()', 'Dir.writeable && Selection.length && Dir["class"] !== "Trash"');
	$Tlb->option('Selection')->option('GZIP')->option('Unpack')->toFunction('Dir.unpack()', 
		'Dir.writeable && Selection.length && Dir["class"] !== "Trash" && Selection.first["class"] == "tgz"');
	$Tlb->option('Selection')->option('Download')->toFunction('Dir.download()', '(Selection.length == 1 && !Selection.first.dir && Dir["class"] !== "Trash")');
	$Tlb->option('Selection')->option('Move To Trash')->toFunction('Dir.trash()', 'Dir.writeable && Selection.length', 'Dir["class"] !== "Trash"');
	$Tlb->option('Selection')->option('Delete Forever!')->toFunction('Dir.trash()', 'Dir.writeable && Selection.length', 'Dir["class"] == "Trash"');
	
?>